package fy.form.hr_plans.operatorImpl;

import com.seeyon.oainterface.exportData.form.ValueExport;

import fy.form.hr_plans.bean.PlanBean;
import fy.form.hr_plans.bean.ProfessionalCompetenceNeedBean;
import fy.form.hr_plans.bean.PsndevelopTrmBean;
import fy.form.hr_plans.bean.SenseOfWorthNeedBean;
import fy.form.listen.bean.FormBean;
import fy.form.listen.operate.AForm_Save_Operator;
import fy.util.MyUtil;

public class PersonalDevelopmentPlansOperatorImpl extends AForm_Save_Operator {

	private PlanBean planBean = new PlanBean();

	private PsndevelopTrmBean[] psndevelopTrmBeans = new PsndevelopTrmBean[5];

	private ProfessionalCompetenceNeedBean[] professionalCompetenceNeedBeans = new ProfessionalCompetenceNeedBean[5];

	private SenseOfWorthNeedBean[] senseOfWorthNeedBeans = new SenseOfWorthNeedBean[4];

	public String getFormName() {
		return "个人发展计划表";
	}

	public boolean save() {
		return false;
	}

	public FormBean getFormBean() {
		return super.formBean;
	}

	@Override
	public void parse() {
		super.parse();
		planBean.setProfessionalCompetenceNeedBeans(professionalCompetenceNeedBeans);
		planBean.setPsndevelopTrmBeans(psndevelopTrmBeans);
		planBean.setSenseOfWorthNeedBeans(senseOfWorthNeedBeans);
		planBean.setSummaryId(super.formBean.getSummaryId());
	}

	private ProfessionalCompetenceNeedBean getProfessionalCompetenceNeedBean(
			int index) {
		if (professionalCompetenceNeedBeans[index] == null) {
			professionalCompetenceNeedBeans[index] = new ProfessionalCompetenceNeedBean();
			professionalCompetenceNeedBeans[index].setRecordnum(String
					.valueOf(index + 1));
		}
		return professionalCompetenceNeedBeans[index];
	}

	private PsndevelopTrmBean getPsndevelopTrmBean(int index) {
		if (psndevelopTrmBeans[index] == null) {
			psndevelopTrmBeans[index] = new PsndevelopTrmBean();
			psndevelopTrmBeans[index].setRecordnum(String.valueOf(index + 1));
		}
		return psndevelopTrmBeans[index];
	}

	private SenseOfWorthNeedBean getSenseOfWorthNeedBean(int index,
			String jobmajor) {
		if (senseOfWorthNeedBeans[index] == null) {
			senseOfWorthNeedBeans[index] = new SenseOfWorthNeedBean();
			senseOfWorthNeedBeans[index]
					.setRecordnum(String.valueOf(index + 1));
			senseOfWorthNeedBeans[index].setJobmajor(jobmajor);
		}
		return senseOfWorthNeedBeans[index];
	}

	@Override
	protected void parseOtherField_FirstStep(
			com.seeyon.v3x.services.flow.bean.FlowExport flowExport) {
		planBean.setTs(MyUtil.getNowStr());
	}

	public PlanBean getPlanBean() {
		return planBean;
	}

	@Override
	protected void parseValueExport(com.seeyon.v3x.services.form.bean.ValueExport ve) {
		String name = ve.getDisplayName();
		String value = ve.getValue();

		if ("工号".equals(name)) {
			planBean.setMemberCode(value);
		} else if ("单据编号".equals(name)) {
			planBean.setFormNumber(value);
		} else if ("直接主管选择".equals(name)) {
			value = ve.getDisplayValue();
			planBean.setDepManager(value);
		} else if ("计划期间起".equals(name)) {
			planBean.setPlanStartDate(MyUtil.getDate(value));
		} else if ("计划期间讫".equals(name)) {
			planBean.setPlanEndDate(MyUtil.getDate(value));
		} else if ("目前岗位_能力差距".equals(name)) {
			planBean.setCompetency_gap(value);
		} else if ("目前岗位_发展需要".equals(name)) {
			planBean.setDevelop_need(value);
		} else if ("目前岗位_学习目标和措施".equals(name)) {
			planBean.setCourse_intent(value);
		} else if ("强项".equals(name)) {
			planBean.setStrengths(value);
		} else if ("长期职业目标".equals(name)) {
			planBean.setJobgoal(value);
		} else if ("长期职业目标_学习目标和措施".equals(name)) {
			planBean.setCourse_intent_remote(value);
		} else if ("勤劳_主管评定".equals(name)) {
			getSenseOfWorthNeedBean(0, "勤劳").setJoblevel(value);
		} else if ("朴实_主管评定".equals(name)) {
			getSenseOfWorthNeedBean(1, "朴实").setJoblevel(value);
		} else if ("学习_主管评定".equals(name)) {
			getSenseOfWorthNeedBean(2, "学习").setJoblevel(value);
		} else if ("创新_主管评定".equals(name)) {
			getSenseOfWorthNeedBean(3, "创新").setJoblevel(value);
		} else if ("勤劳_现有水平".equals(name)) {
			getSenseOfWorthNeedBean(0, "勤劳").setJoblevel1(value);
		} else if ("朴实_现有水平".equals(name)) {
			getSenseOfWorthNeedBean(1, "朴实").setJoblevel1(value);
		} else if ("学习_现有水平".equals(name)) {
			getSenseOfWorthNeedBean(2, "学习").setJoblevel1(value);
		} else if ("创新_现有水平".equals(name)) {
			getSenseOfWorthNeedBean(3, "创新").setJoblevel1(value);
		} else if ("过程和专业能力1".equals(name)) {
			getProfessionalCompetenceNeedBean(0).setJobmajor(value);
		} else if ("过程和专业能力_主管评定1".equals(name)) {
			getProfessionalCompetenceNeedBean(0).setJoblevel(value);
		} else if ("岗位要求1".equals(name)) {
			getProfessionalCompetenceNeedBean(0).setJobneed(value);
		} else if ("过程和专业能力2".equals(name)) {
			getProfessionalCompetenceNeedBean(1).setJobmajor(value);
		} else if ("过程和专业能力_主管评定2".equals(name)) {
			getProfessionalCompetenceNeedBean(1).setJoblevel(value);
		} else if ("岗位要求2".equals(name)) {
			getProfessionalCompetenceNeedBean(1).setJobneed(value);
		} else if ("过程和专业能力3".equals(name)) {
			getProfessionalCompetenceNeedBean(2).setJobmajor(value);
		} else if ("过程和专业能力_主管评定3".equals(name)) {
			getProfessionalCompetenceNeedBean(2).setJoblevel(value);
		} else if ("岗位要求3".equals(name)) {
			getProfessionalCompetenceNeedBean(2).setJobneed(value);
		} else if ("过程和专业能力4".equals(name)) {
			getProfessionalCompetenceNeedBean(3).setJobmajor(value);
		} else if ("过程和专业能力_主管评定4".equals(name)) {
			getProfessionalCompetenceNeedBean(3).setJoblevel(value);
		} else if ("岗位要求4".equals(name)) {
			getProfessionalCompetenceNeedBean(3).setJobneed(value);
		} else if ("过程和专业能力5".equals(name)) {
			getProfessionalCompetenceNeedBean(4).setJobmajor(value);
		} else if ("过程和专业能力_主管评定5".equals(name)) {
			getProfessionalCompetenceNeedBean(4).setJoblevel(value);
		} else if ("岗位要求5".equals(name)) {
			getProfessionalCompetenceNeedBean(4).setJobneed(value);
		} else if ("过程和专业能力_员工自评1".equals(name)) {
			getProfessionalCompetenceNeedBean(0).setJoblevel1(value);
		} else if ("过程和专业能力_员工自评2".equals(name)) {
			getProfessionalCompetenceNeedBean(1).setJoblevel1(value);
		} else if ("过程和专业能力_员工自评3".equals(name)) {
			getProfessionalCompetenceNeedBean(2).setJoblevel1(value);
		} else if ("过程和专业能力_员工自评4".equals(name)) {
			getProfessionalCompetenceNeedBean(3).setJoblevel1(value);
		} else if ("过程和专业能力_员工自评5".equals(name)) {
			getProfessionalCompetenceNeedBean(4).setJoblevel1(value);
		} else if ("what_1".equals(name)) {
			getPsndevelopTrmBean(0).setCourse_name(value);
		} else if ("how_1".equals(name)) {
			getPsndevelopTrmBean(0).setTeach_mothed(value);
		} else if ("内容_1".equals(name)) {
			getPsndevelopTrmBean(0).setCourse_content(value);
		} else if ("建议学时1".equals(name)) {
			getPsndevelopTrmBean(0).setCourse_time(value);
		} else if ("what_2".equals(name)) {
			getPsndevelopTrmBean(1).setCourse_name(value);
		} else if ("how_2".equals(name)) {
			getPsndevelopTrmBean(1).setTeach_mothed(value);
		} else if ("内容_2".equals(name)) {
			getPsndevelopTrmBean(1).setCourse_content(value);
		} else if ("建议学时2".equals(name)) {
			getPsndevelopTrmBean(1).setCourse_time(value);
		} else if ("what_3".equals(name)) {
			getPsndevelopTrmBean(2).setCourse_name(value);
		} else if ("how_3".equals(name)) {
			getPsndevelopTrmBean(2).setTeach_mothed(value);
		} else if ("内容_3".equals(name)) {
			getPsndevelopTrmBean(2).setCourse_content(value);
		} else if ("建议学时3".equals(name)) {
			getPsndevelopTrmBean(2).setCourse_time(value);
		} else if ("what_4".equals(name)) {
			getPsndevelopTrmBean(3).setCourse_name(value);
		} else if ("how_4".equals(name)) {
			getPsndevelopTrmBean(3).setTeach_mothed(value);
		} else if ("内容_4".equals(name)) {
			getPsndevelopTrmBean(3).setCourse_content(value);
		} else if ("建议学时4".equals(name)) {
			getPsndevelopTrmBean(3).setCourse_time(value);
		} else if ("what_5".equals(name)) {
			getPsndevelopTrmBean(4).setCourse_name(value);
		} else if ("how_5".equals(name)) {
			getPsndevelopTrmBean(4).setTeach_mothed(value);
		} else if ("内容_5".equals(name)) {
			getPsndevelopTrmBean(4).setCourse_content(value);
		} else if ("建议学时5".equals(name)) {
			getPsndevelopTrmBean(4).setCourse_time(value);
		}
	}
}
